<?php
// redis
import("@.ORG.MyRedis"); 

class InfoAction extends Action 
{
    //班级简介
    public function index()
    {
        header("Content-Type:text/html; charset=utf-8");
		$redis = new MyRedis();
        // 获取redis的KEY
        $info = D("info");
        $redisKey = $info->getRedisPrefix("all");
        $infoVal = $redis->get($redisKey);
        if (empty($infoVal)) {
            $infoVal = $info->setInfoCountent();
            $redis->set($redisKey, $infoVal);
        }

        $this->assign("infoVal", $infoVal);
        $this->display();
    }

	public function regist()
    {
        header("Content-Type:text/html; charset=utf-8");

        $this->display();
    }

    /**
     * 清除缓存
     */
    public function clear()
    {
        $info = D("info");
        $redisKey = $info->getRedisPrefix("all");

        $redis = new MyRedis();
        $redis->delete($redisKey);
        $k = $redis->exists($redisKey);
        if ($k === false) 
        {
            $this->success("缓存清除成功！");
        }
        else 
        {
            $this->error("缓存清除失败！");
        }
       
    }
}
?>